{layout name="layout" /}

<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    <a href="{:url('index/index')}"> 首页</a>
    <span class="c-gray en">&gt;</span>
    <a href="{:url('category/index')}">栏目管理</a>
    <span class="c-gray en">&gt;</span>
    <a href="javascprit:void(0);">{$data.id ? '修改' : '新增'}</a>
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
        href="javascript:location.replace(location.href);" title="刷新">
        <i class="Hui-iconfont">&#xe68f;</i>
    </a>
</nav>

<div class="Hui-article">
    <article class="cl pd-20">
        <form action="{:url('category/save?id='.$data.id)}" method="post" class="form form-horizontal"
            id="form-admin-category">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">
                    <span class="c-red">*</span>上级栏目：</label>
                <div class="formControls col-xs-4 col-sm-4">
                    <span class="select-box">
                        <select class="select" id="sel_Sub" name="pid">
                            <option value="0" {eq name='data.pid' value="0" }selected{/eq}>--顶级栏目--</option>
                            {foreach $dataParent as $value}
                            <option value="{$value.id}" {eq name='value.id' value="$data.pid" }selected{/eq}>
                                {$value.name}</option>
                            {notempty name="value.child"} {foreach $value.child as $val}
                            <option value="{$val.id}" {eq name='val.id' value="$data.pid" }selected{/eq}>&nbsp;&nbsp;└
                                --{$val.name}</option>
                            {/foreach} {/notempty} {/foreach}
                        </select>
                    </span>
                </div>
                <div class="col-3"> </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">
                    <span class="c-red">*</span>栏目名称：</label>
                <div class="formControls col-xs-4 col-sm-4">
                    <input type="text" class="input-text" value="{$data.name}" placeholder="请填写栏目名称" id="name"
                        name="name">
                </div>
                <div class="col-3"> </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">
                    列表模板：</label>
                <div class="formControls col-xs-4 col-sm-4">
                    <span class="select-box">
                        <select class="select" id="template_list_id" name="template_list_id">
                            <option value="0" {eq name='data.pid' value="0" }selected{/eq}>系统模板</option>
                            {notempty name="templateList"}
                            {foreach $templateList as $value}
                            <option value="{$value.id}" {eq name='value.id' value="$data.template_list_id" }selected{/eq}>
                                {$value.name}</option>
                            {/foreach}{/notempty}
                        </select>
                    </span>
                </div>
                <div class="col-3"> </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">
                    详情模板：</label>
                <div class="formControls col-xs-4 col-sm-4">
                    <span class="select-box">
                        <select class="select" id="template_detail_id" name="template_detail_id">
                            <option value="0" {eq name='data.pid' value="0" }selected{/eq}>系统模板</option>
                            {notempty name="templateDetail"}
                            {foreach $templateDetail as $value}
                            <option value="{$value.id}" {eq name='value.id' value="$data.template_detail_id" }selected{/eq}>
                                {$value.name}</option>
                            {/foreach}{/notempty}
                        </select>
                    </span>
                </div>
                <div class="col-3"> </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">类型</label>
                <div class="formControls col-xs-8 col-sm-4">
                    <span class="select-box" style="width:150px;">
                        <select class="select" id="type" name="type">
                            <option value="0" {eq name='data.type' value="0" }selected{/eq}>终极栏目</option>
                            <option value="1" {eq name='data.type' value="1" }selected{/eq}>目录</option>
                            <option value="2" {eq name='data.type' value="2" }selected{/eq}>单页</option>
                        </select>
                    </span>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">排序：</label>
                <div class="formControls col-xs-4 col-sm-4">
                    <input type="number" min=0 max=100 class="input-text" value="{$data.sort}" name="sort"
                        style="width:60px;">
                </div>
                <div class="col-3"> </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">备注：</label>
                <div class="formControls col-xs-8 col-sm-6">
                    <textarea name="remark" id="remark" cols="" rows="" class="textarea" placeholder="说点什么...最多输入100个字符"
                        datatype="*10-100" dragonfly="true" nullmsg="备注不能为空！"
                        onKeyUp="textarealength(this,200)">{$data.remark}</textarea>
                    <p class="textarea-numberbar">
                        <em class="textarea-length">0</em>/200
                    </p>
                </div>
                <div class="col-3"> </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <button type="submit" class="btn btn-success radius" id="admin-powers-save"
                        name="">确&nbsp;定</button>
                    <button type="button" class="btn btn-default radius" onclick="window.history.back();"
                        style="margin-left:20px;">取&nbsp;消</button>
                </div>
            </div>
        </form>
    </article>
</div>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    $("#form-admin-category").submit(function () {
        var name = $("#name").val();

        if (name == null || name == "" || name.length < 1) {
            layer.msg('名称不能为空', {
                icon: 5,
                time: 1000
            });
            return false;
        }
    })
</script>